package com.shangqing.web.controller.system;

import com.shangqing.common.core.domain.AjaxResult;
import com.shangqing.system.domain.rainfall.Rainfall;
import com.shangqing.system.service.RainfallService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "强降雨", description = "强降雨相关接口", position = 1)
@RestController
@RequestMapping("/rainfall")
public class RainfallController {
    @Autowired
    private RainfallService rainfallService;

    @ApiOperation(value = "灾情信息", notes = "注意参数必填", position = 11)
    @GetMapping("/list")
    public AjaxResult getInfo() {
      List<Rainfall> rainfallList=rainfallService.selectall();


        if (rainfallList.isEmpty()) {
            return AjaxResult.error(404, "没有找到");
        } else {
            return AjaxResult.success("成功了", rainfallList);
        }
    }


}
